<script type="text/javascript" src="<?php echo base_url('assets/js/uploadify/jquery.uploadify.v2.1.4.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/uploadify/swfobject.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/messages.js'); ?>"></script>
<?php	$email = $_SESSION['email'];
		$msgtype = $this->uri->segment(3);
		$preview = true;
		if($msgtype == 'notes' || $msgtype== 'journal' || $msgtype == 'documents' ){
			$preview = false;
		}
	 $recipients = myuser_helper::getUserRecipients();
?>
<div id = "main-contentz">
	<div id="main-content-area" style="margin-top:60px;">
		<div id="main-content-wrap" style="height:560px;">
			<div id = "add-messages-wrap">
				<div id = "top-messages">
					<h2 style = "float:left; color:#fff; font-size:14px; margin-top:10px; margin-left:10px" >Add Messages</h2>
				</div>
				<div id = "con-messages">
					<form id = "add_messages_frm" name = "add_messages_frm" method="POST">
					<?php echo form_hidden('type', $this->uri->segment(3)); ?>
					<input id = "hidden2" type = "hidden" value = "<?php echo base_url();?>index.php/messages/createMessage"/>
						<div class = "error-r"></div>
						<div class = "loader"><img src = "<?php echo base_url();?>assets/images/ajax-loader.gif" alt = "loader" /></div>
						<div>
						<p class = "add-messages"></p>
						<br/>
						<p>
							<label><p>To </p><p><?php echo totype('totype', 'id="totype"');  ?></p></label></p>
							<label id="totype-desc">Your message will be sent to all your recipients.</label>
							<p>
							<div id="totype-list-recipients">
								<label>Select Recipient(s)</label>
								<ul>
									<?php
									if(!empty($recipients)){
										foreach($recipients as $recipient){ ?>
											<li>
											<div class="recipeint-list">
												<div class="rec-check"><input type="checkbox" name="recipientid[]" value="<?php echo $recipient->recipientid; ?>" /></div>
												<div class="rec-info">
													<?php
													echo $recipient->fname.' '.$recipient->mname.' '.$recipient->lname;
													//if($recipient->relationship) echo '<br />';
													//echo $recipient->relationship;
													if($recipient->email) echo '<br />';
													echo $recipient->email;
													?>
												</div>
											</div>
											</li>
									<?php
										}
									}else{
										echo 'No Recipient found. <a href="'.base_url('recipients/add_recipients').'">Click here to add.</a>';
									}
									?>
								</ul>
							</div>
							</p>
							<!--input type = "text" value = "To" name = "m-to" id = "m-to" /-->

						</p>
						<p class = "add-messages"><input type = "text" value = "Subject" name = "m-subject" id = "m-subject" /></p>
						<p class = "add-messages">
							<?php
							if($msgtype == 'photos' || $msgtype == 'videos' || $msgtype == 'documents'){
								include('messages_upload_view.php');
							} else {
								echo '<textarea id="m-message" name="m-message"></textarea>';
							}
							?>
						</p>

						<p style = "float:right; margin-right:20px;">
							<input type="hidden" name="msgtype" id="msgtype" value="<?php echo $msgtype; ?>" />
							<input type="image" value="" alt="" id="messages-submit" src="<?php echo base_url(); ?>assets/images/submit.png">
							<a href="<?php echo base_url().'messages/type/'.$msgtype ;?>"><img src="<?php echo base_url(); ?>assets/images/cancel.png" alt="" id="messages-cancel" /></a>
							<!--input type="image" value="" alt="" id="messages-cancel" src="<?php echo base_url(); ?>assets/images/cancel.png"-->
						</p>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>